import tools from "../utils/tools.js";

export const positionProps = {
  // 定位方式
  position: {
    type: String,
  },
  // 距离顶部
  top: {
    type: [String, Number],
  },
  // 距离底部
  bottom: {
    type: [String, Number],
  },
  // 距离左侧
  left: {
    type: [String, Number],
  },
  // 距离右侧
  right: {
    type: [String, Number],
  },
};
export function positionStyle(props) {
  if (!props.position) return {};
  return {
    position: props.position,
    top: props.top && tools.addUnit(props.top),
    bottom: props.bottom && tools.addUnit(props.bottom),
    left: props.left && tools.addUnit(props.left),
    right: props.right && tools.addUnit(props.right),
  };
}
